//
#ifndef UC_BRENT_H
#define UC_BRENT_H 1

#include "zadesk.h"
#include "zrxobject.h"
#include "zrxboiler.h"
#include "zgegbl.h"
#include "ucbrgbl.h"
#include "ucbrprops.h"


// forward class declarations
class UcDbFullSubentPath;
class UcGeBoundBlock3d;
class UcGePoint3d;
class UcGeLinearEnt3d;
class UcBrHit;
class UcBrBrep;
class UcBrEntityImp;
class UcBrBrepData;


class DllImpExp UcBrEntity : public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcBrEntity);
    virtual ~UcBrEntity();
    
    // Equivalence                    
    ZSoft::Boolean      isEqualTo       (const UcRxObject* other) const;
    
    // Queries & Initialisers
    ZSoft::Boolean      isNull          () const;
    UcBr::ErrorStatus   setSubentPath   (UcDbFullSubentPath& subpath);
    UcBr::ErrorStatus   getSubentPath   (UcDbFullSubentPath& subPath) const;
	
	ZSoft::Boolean		checkEntity		() const;
	void*				getEntity		() const;
	UcBr::ErrorStatus	setEntity		(void*	pData,
										 UcDbFullSubentPath& subPath = *(UcDbFullSubentPath*)NULL);

    // Geometric bounds (i.e., model space bounding box)
    UcBr::ErrorStatus   getBoundBlock   (UcGeBoundBlock3d& block) const;

    // Set-Membership Classification
    UcBr::ErrorStatus   getPointContainment(const UcGePoint3d& point,
                                            UcGe::PointContainment& containment,
                                            UcBrEntity*& container) const;

    UcBr::ErrorStatus   getLineContainment(const UcGeLinearEnt3d& line,
                                           const ZSoft::UInt32& numHitsWanted,
                                           ZSoft::UInt32&       numHitsFound,
                                           UcBrHit*&            hits) const;

    // Upward link to brep owner of subentity (1::1)
    UcBr::ErrorStatus   getBrep         (UcBrBrep& brep) const;

	// Validation
	UcBr::ErrorStatus	setValidationLevel(const UcBr::ValidationLevel& level = *(UcBr::ValidationLevel*)NULL);
	UcBr::ErrorStatus	getValidationLevel(UcBr::ValidationLevel& level) const;
	ZSoft::Boolean		brepChanged		() const;

    // Queries & Initialisers
    UcBr::ErrorStatus   set				(const UcDbFullSubentPath& path);
    UcBr::ErrorStatus   get				(UcDbFullSubentPath& path) const;
	UcBr::ErrorStatus	set				(UcBrBrepData* data);
	UcBr::ErrorStatus	get				(UcBrBrepData*& data) const;

	// Geometric properties
	UcBr::ErrorStatus	getMassProps	(UcBrMassProps& massProps,
		                                 const double&  density     = *(double*)NULL,
		                                 const double&  tolRequired = *(double*)NULL,
		                                 double&        tolAchieved = *(double*)NULL) const;
	UcBr::ErrorStatus	getVolume		(double&       volume,
		                                 const double& tolRequired = *(double*)NULL,
		                                 double&       tolAchieved = *(double*)NULL) const;
	UcBr::ErrorStatus	getSurfaceArea	(double&       area,
		                                 const double& tolRequired = *(double*)NULL,
		                                 double&       tolAchieved = *(double*)NULL) const;
	UcBr::ErrorStatus	getPerimeterLength(double&       length,
		                                   const double& tolRequired = *(double*)NULL,
		                                   double&       tolAchieved = *(double*)NULL) const;

    void* internalImp() const { return mpImp; }

protected:
    UcBrEntity();
    UcBrEntity(const UcBrEntity& src);
    UcBrEntity&         operator =      (const UcBrEntity& src);

    UcBrEntityImp*      mpImp;
};


#endif

